1. Technical Field
The application relates to a method of threshold setting and related electronic device, and more particularly, to a method of dynamically adjusting threshold values and related electronic device.
2. Background
A proximity sensor is used to setup two threshold values. One is a high threshold value and the other is a low threshold value. Proximity interrupt will occur when proximity sensor detected a detected proximity value which is greater than the high threshold value or less than the low threshold value. Proximity interrupt will not occur, when the detected proximity value is greater or equal to the low threshold or when the detected proximity value is lower or equal to the high threshold.
As time goes by, the detected proximity value of the proximity sensor will increase because there will be dust or oil stocked on or blocked the optical path of the proximity sensor. Once the detected proximity value passes over the high threshold setting due to dust or oil accumulation, the proximity sensor would always detect a NEAR signal which indicates an object that is close or in proximity to the proximity sensor. As long as NEAR signal is detected, a FAR signal may not be detected to indicate that there is no object close by anymore. For example, the proximity sensor will proceed with the detection of dust particle as object that is close or in proximity to the proximity sensor. This caused the detected proximity value always higher than the low threshold and a FAR signal is not detected.
When an incoming call is received, the phone application (AP: Application Program) executed in CPU will enable a proximity sensor via an i2c interface. When the proximity sensor detects any object in proximity via IR LED reflection strength, an interrupt will be triggered to inform the CPU. If the interrupt information indicates NEAR, CPU will disable backlight and touch screen. If the interrupt information indicates FAR, CPU will be informed by a FAR event and enable backlight and touch screen. If there is dust stocked on or blocked the proximity sensor, the proximity sensor always detects a NEAR signal because detected proximity value is always higher then the low threshold. This will result in deactivating the backlight and touch screen during calling operation.